﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace elcalc
{
    public partial class Omregner : Form
    {
        public Omregner()
        {
            InitializeComponent();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if (textBox1.Focused)
            {
                try
                {
                    double cos = Double.Parse(textBox1.Text);
                    cos = Math.Acos(cos);
                    double vinkel = cos * (180 / Math.PI);
                    textBox2.Text = vinkel.ToString();
                }
                catch
                {
                }
            }
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            if (textBox2.Focused)
            {
                try
                {
                    double vinkel = Double.Parse(textBox2.Text);
                    vinkel = 2 * Math.PI * (vinkel / 360);
                    vinkel = Math.Cos(vinkel);
                    textBox1.Text = vinkel.ToString();
                }
                catch
                {
                }
                }

        }
    }
}
